/* 2017-9-28 16:04:24 | 修改 木遥（微信:  http://marsgis.cn/weixin.html ） */
//模块：
mars3d.widget.bindClass(mars3d.widget.BaseWidget.extend({
    options: {
        resources: [
            // './lib/cesiumjs/plugins/gif/gifuct-js.js',
            // './lib/cesiumjs/plugins/gif/GifImageProperty.js',
            'Typhoon.js',
        ],
        //弹窗
        view: {
            type: "window",
            url: "view.html",
            windowOptions: {
                width: 250,
                height: 500
            }
        },
    },
    //初始化[仅执行1次]
    create: function () {

    },
    viewWindow: null,
    //每个窗口创建完成后调用
    winCreateOK: function (opt, result) {
        this.viewWindow = result;
    },
    //打开激活
    activate: function () {

        viewer.clock.multiplier = 2000;


    },
    //关闭释放
    disable: function () {
        this.viewWindow = null;

        if (this.lastTyphoon) {
            this.lastTyphoon.setVisible(false);
            this.lastTyphoon = null;
        }
        viewer.clock.multiplier = 1;

    },
    objData: {},
    queryData: function (param, calback) {
        this.objData = {};

        var that = this;

        //改为从后台去获取数据
        $.getJSON(this.path + "data/getTyphoon.json", function (result) {
            var arrdata = result.data;

            for (var i = 0; i < arrdata.length; i++) {
                var item = arrdata[i];
                 
                var typhoon = new Typhoon(viewer, item);
                that.objData[item.tfid] = typhoon;
            } 

            calback(arrdata);
        });


    },
    lastTyphoon: null,
    showItem: function (tfid) {
        if (this.lastTyphoon) {
            this.lastTyphoon.setVisible(false);
            this.lastTyphoon = null;
        }

        var typhoon = this.objData[tfid];
        if (typhoon == null) return;

        typhoon.setVisible(true);
        this.lastTyphoon = typhoon;
    },





}));

